<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    {% include "head.html" ignore missing %}
</head>

<body>
    {% include "nav.html" %}
    <div class="container film-list">
        <div class="row" id="row">
            {% for item in filmList %}
            <div class="col-sm col-xl-3">
                <div class="card" style="width: 18rem;">
                    <div class="card-img">
                        <img class="card-img-top" src="{{item.pic_url}}" alt="{{item.name}}" title="{{item.name}}">
                    </div>
                    <div class="card-body">
                        <h5 class="card-title">{{item.name}}</h5>
                        <p class="card-text"></p>
                        <a href="{{'/detail?id=' +  item.id}}" class="btn btn-dark">下载地址</a>
                    </div>
                </div>
            </div>
            {% endfor %}
        </div>
    </div>
    <div class="pagegination-list">
        <nav aria-label="...">
            <ul class="pagination">
                {% if page == 1%}
                <li class="page-item disabled">
                        <a class="page-link" href="{{'/?page=' + (page)}}" tabindex="-1">没有了</a>
                      </li>
                {% else %}
                <li class="page-item ">
                        <a class="page-link" href="{{'/?page=' + (page - 1)}}" tabindex="-1">上一页</a>
                      </li>
                {% endif %}
              
              {% for item in range(1, pageCount + 1) -%}
                {% if item == page %}
                    <li class="page-item active"><a class="page-link" href="{{'/?page=' + item}}">{{item}}</a></li>
                {% else %}
                    <li class="page-item"><a class="page-link" href="{{'/?page=' + item}}">{{item}}</a></li>
                {% endif %}
              {% endfor -%}
              {% if page == pageCount%}
                <li class="page-item disabled">
                    <a class="page-link" href="{{'/?page=' + (page)}}">没有了</a>
                </li>
                {% else %}
                <li class="page-item ">
                    <a class="page-link" href="{{'/?page=' + (page + 1)}}">下一页</a>
                </li>
                {% endif %}
            </ul>
          </nav>
    </div>
    {% include "footer.html" %}
    {% include "script.html" %}
    <script src="/static/js/index.js"></script>
</body>

</html>